package com.jdbc;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.jdbc.dbcon;

public class jdbcTest {
	static Connection conn;
	static Statement st;
	static dbcon c = new dbcon();
	public  void query(){
		conn = c.getConnection();
		try {
			String sql = "select * from user_info";
			st = conn.createStatement();
			ResultSet rs = st.executeQuery(sql);
			System.out.println("Result:");
			while (rs.next()){
				String uid=rs.getString("uid");
				String loginname= rs.getString("loginname");
				String displayname = rs.getString(4);
				String gender = rs.getString(5);
				String idno = rs.getString(6);
				String mobile = rs.getString("mobile");
				System.out.println(uid+" "+loginname+" "+displayname+" "
						+gender+" "+idno+" "+ mobile);
			}
			conn.close();
		}catch(SQLException e){
			System.out.println("查询失败："+e.getMessage());
		}
		
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		jdbcTest t = new jdbcTest();
		t.query();
	}

}
